import {
	myRequest
} from '../http.js'
import qs from 'qs'
export function getmycompany() {
	return myRequest({
		url: "/company/company?lang=cn",
		method: 'get',
	})
}
export function submycompany(data) {
	return myRequest({
		url: "/company/editpost",
		method: 'post',
		data: qs.stringify(data)
	})
}
//用户密码修改提交

export function changePwd(data) {
	return myRequest({
		url: '/password/cooperation',
		method: 'post',
		data: data
	})
}
//收获地址管理
export function getaddress(data) {
	return myRequest({
		url: `/address/address?lang=cn&search=${data.search}&sortAttr=${data.sortAttr}&sortMode=${data.sortMode}&page=${data.page}&limit=${data.limit}`,
		method: 'get',
	})
}
//修改收获地址
export function editaddress(data) {
	return myRequest({
		url: '/address/editpost',
		method: 'post',
		data: qs.stringify(data)
	})
}
//删除收获地址
// address_id: 5926
export function deleaddress(data) {
	return myRequest({
		url: '/address/delete',
		method: 'post',
		data: qs.stringify(data)
	})
}
//添加收货地址
export function addAddress(data) {
	return myRequest({
		url: '/address/add',
		method: 'post',
		data: qs.stringify(data)
	})
}
export function getaddressitem(address_id) {
	return myRequest({
		url: `/address/edit?address_id=${address_id}`,
		method: 'get'
	})
}

//获取子公司分公司列表
export function getchildcompany(data) {
	return myRequest({
		url: `/branch/branch_list?lang=cn&company_id=${data.company_id}&search=${data.search}&sortAttr=${data.sortAttr}&sortMode=${data.sortMode}&page=${data.page}`,
		method: 'get'
	})
}
export function getamount(data) {
	return myRequest({
		url: `/branch/amount?branch_id=${data.branch_id}`,
		method: 'get'
	})
}
export function getparent(data) {
	return myRequest({
		url: `/branch/parent?lang=cn&company_id=${data.company_id}`,
		method: 'get'
	})
}
export function delcompany(data) {
	return myRequest({
		url: `/branch/delete`,
		method: 'post',
		data: qs.stringify(data)
	})
}
export function addchildcompany(data) {
	return myRequest({
		url: '/branch/add',
		method: 'post',
		data: qs.stringify(data)
	})
}
export function getcompanybyid(data){
	return myRequest({
		url: `/branch/edit?branch_id=${data.branch_id}`,
		method: 'get',
	})
}

export function editconpany(data){
	return myRequest({
		url: '/branch/editpost',
		method: 'post',
		data: qs.stringify(data)
	})
}
//获取部门列表
export function getdepartment(data){
	return myRequest({
		url: `/department/department_list?lang=cn&company_id=${data.company_id}&search=${data.search}&sortAttr=${data.sortAttr}&sortMode=${data.sortMode}&page=${data.page}`,
		method: 'get',
	})
}
//获取所属子公司分公司
export function getbranch(data){
	return myRequest({
		url: `/department/parent?lang=cn&company_id=${data.company_id}&branch_id=${data.branch_id}`,
		method: 'get',
	})
}

//根据部门id获取部门
export function getdepartmentByid(data){
	return myRequest({
		url: `/department/edit?department_id=${data.department_id}`,
		method: 'get',
	})
}
//编辑单个部门信息
export function editdepartment(data){
	return myRequest({
		url: '/department/editpost',
		method: 'post',
		data: qs.stringify(data)
	})
}
//删除部门
export function deldepartment(data){
	return myRequest({
		url: '/department/delete',
		method: 'post',
		data: qs.stringify(data)
	})
}
//添加部门
export function adddepartment(data){
	return myRequest({
		url: '/department/add',
		method: 'post',
		data: qs.stringify(data)
	})
}
//获取用户列表
export function getuser(data){
	return myRequest({
		url: `/member/member?lang=cn&company_id=${data.company_id}&search=${data.search}&sortAttr=${data.sortAttr}&sortMode=${data.sortMode}&page=${data.page}`,
		method: 'get',
	})
}
//获取单个用户信息
export function getedituser(data){
	return myRequest({
		url: `/member/edit?user_id=${data.user_id}`,
		method: 'get',
	})
}
//获取用户所属部门
export function getuserdepartment(data){
	return myRequest({
		url: `/member/parent?lang=cn&company_id=${data.company_id}`,
		method: 'get',
	})
}
//获取权限列表
export function getuserpower(){
	return myRequest({
		url: `/member/character?lang=cn`,
		method: 'get',
	})
}
//获取部门信息
export function getdepartmentinfo(data){
	return myRequest({
		url: `/member/jurisdiction2?lang=cn&company_id=${data.company_id}`,
		method: 'get',
	})
}
//获取用户所属角色
export function getdepartment_list(data){
	return myRequest({
		url: `/member/department_list?lang=cn&company_id=${data.company_id}&branch_id=${data.branch_id}`,
		method: 'get',
	})
}
//删除用户
export function deluser(data){
	return myRequest({
		url: '/member/delete',
		method: 'post',
		data: qs.stringify(data)
	})
}
//获取超级管理员、管理员、普通用户、下单
export function getusercharacter(data){
	return myRequest({
		url: `/member/character?lang=cn`,
		method: 'get',
	})
}
//添加超级管理员、管理员、普通用户、下单
export function adduser(data){
	return myRequest({
		url: '/member/add',
		method: 'post',
		data: qs.stringify(data)
	})
}
//修改用户信息
export function edituser(data){
	return myRequest({
		url: '/member/editpost',
		method: 'post',
		data: qs.stringify(data)
	})
}
//月结单下载
export function getmonthbill(data){
	return myRequest({
		url: `/month/order`,
		method: 'post',
		data:qs.stringify(data)
	})
}
//数据分析订单号列表
export function getsaleorder(data){
	return myRequest({
		url: `/sale/order`,
		method: 'post',
		data:{
			lang:'cn',
		}
	})
}
export function  getsalegood(){
	return myRequest({
		url: `/sale/goods?lang=cn`,
		method: 'get',
	})
}
//获取所有品牌
export function getallbrand(){
	return myRequest({
		url: `/goodslist/brand?lang=cn&id=`,
		method: 'get',
	})
}
export function getsalemember(data){
	return myRequest({
		url: `/sale/member?lang=cn&company_id=${data.company_id}&branch_id=${data.branch_id}`,
		method: 'get',
	})
}
//查询表格
export function gettable(data){
	return myRequest({
		url: `/sale/raw_data`,
		method: 'post',
		data:qs.stringify(data)
	})
}
//获取echart数据
export function getechartnumber(data){
	return myRequest({
		url: `/sale/order_number`,
		method: 'post',
		data:qs.stringify(data)
	})
}
//获取echart数据
export function getechartamount(data){
	return myRequest({
		url: `/sale/order_amount`,
		method: 'post',
		data:qs.stringify(data)
	})
}
//数据分析下载表格
export function getdownload(data){
	return myRequest({
		url: `/sale/export`,
		method: 'post',
		data:qs.stringify(data)
	})
}
